Kernel and application cooperative memory management

ABSTRACT

Embodiments of the present invention provide a mechanism for an operating system and applications to cooperate in memory management. Applications register with the operating system for cooperative memory management. The operating system monitors the memory and determines a memory “pressure” related to the amount of demand for the memory. As the memory pressure increases, the operating system provides a memory pressure signal as feedback to the registered applications. The operating system may send this signal to indicate it is about to commence evicting pages from the memory or when it has commenced swapping out application data. In response to the signal, the registered applications may evaluate the memory pressure, determine which data should be freed, if any, and provide this information back to the operating system. The operating system may then free those portions of memory relinquished by the applications. By releasing data the system may thus avoid swapping and increase its performance.

FIELD OF THE INVENTION

The present invention relates generally to computer memory management.More particularly, the present invention relates to kernel andapplication cooperative memory management.

BACKGROUND OF THE RELATED ARTS

Memory management is one of the most fundamental issues of moderncomputer systems. Typically, a computer system will include a hierarchyof memory that ranges from a small, fast cache of main memory that isplaced in front of a larger, but slower, auxiliary memory. The cache isgenerally implemented using a physical memory, such as RAM, while theauxiliary memory is implemented using a storage device, such as a diskdrive or hard disk. Both memories are usually managed in uniformly sizedunits known as pages.

In order to improve performance, many computers and operating systemstoday implement virtual memory for the applications running on thecomputer. Virtual memory is where the computer system emulates that ithas more physical memory than the computer system actually possesses.For example, most computer systems utilize 32-bit processors. Hence, acomputer system is theoretically capable of providing a virtual memoryof approximately 232 bits or approximately 4 Gigabytes, even though thephysical memory is usually much smaller.

In order to provide a virtual memory of this size, the computer systemruns the application or process in a memory address space that isvirtual, i.e., not tied to the physical memory. The computer system willthen swap pages in and out of a cache in its physical memory in order toemulate the virtual memory. During operation, an application or processwill continually requests pages using virtual memory addresses. Inresponse, the computer system will translate the virtual memory addressinto a physical memory address and determine if the page is present inthe cache (i.e., the page is resident). When a requested page is notpresent in the cache, it is called a cache “miss” (or page fault), andthe requested page must be retrieved from storage. However, when thecache is full, before a new page can be brought into the cache, anotherpage (known as the victim page) must be evicted to storage. Typically,an operating system will use a global page replacement algorithm, suchas “least recently used,” to share its physical memory with multiplealgorithms.

Unfortunately, the use of virtual memory by operating systems makesapplications unaware of the competition for space in the physicalmemory. That is, conventional operating systems will unilaterallydetermine how to manage the physical memory. Applications are thusforced to trust that the operating system can efficiently manage itsphysical memory for them.

However, in modern computing environments, applications utilize a largeamount of their virtual memory. For example, applications, such as webbrowsers and database applications, often use large amounts of theirvirtual memory for uncompressed data. In addition, the workloads of manyapplications, such as interactive applications, can be unpredictable andcause the operating system to consume most or all of its physicalmemory. This can result in heavy paging activity by the operating systembetween its memory and secondary storage in order swap in/out pages forthe applications.

Paging activity seriously degrades the performance of applications,because the cost of I/O between memory and storage is quite high. Inmany instances, an application could have performed better by freeingsome of its memory before heavy paging activity by the operating system.For example, it is often faster for an application torecalculate/reprocess its cached data than to swap it out and back fromstorage. In particular, a web browser can often decompress an image muchfaster than having it paged out and back from storage. In general,applications are in the better position to determine which of their datashould be swapped in/out or freed and reprocessed. However, as notedabove, conventional operating systems manage memory unilaterally,without the cooperation of the applications.

Accordingly, it would be desirable to provide a mechanism in whichapplications and an operating system could efficiently share memory. Itwould also be desirable to provide mechanisms in which an operatingsystem and applications could cooperatively manage the memory of thecomputer system.

SUMMARY

In accordance with one feature of the invention, a method is providedfor providing a feedback signal that indicates a memory pressure in acomputer system. A memory pressure on a physical memory in the computersystem is determined and a feedback signal indicating the memorypressure is determined. Applications running on the computer system thathave registered for the signal are identified. The feedback signal isthen provided to the registered applications.

In accordance with another feature of the invention, a method for anapplication to cooperate with an operating system is provided. Theoperating system provides the application a virtual memory and maps atleast a portion of the virtual memory to a physical memory. A feedbacksignal is received from the operating system and indicates a memorypressure on the physical memory. The application determines a cost offreeing at least some of its virtual memory based on the memorypressure. The application then may release at least some of its virtualmemory based on the cost of freeing and the feedback signal.

In accordance with another feature of the invention, a method ofmanaging a physical memory in a computer system is based on cooperationbetween the operating system and applications running on the computersystem. The operating system determines a memory pressure on thephysical memory. One or more applications register with the operatingsystem and are configured to cooperate with the operating system. Afeedback signal is sent to the registered applications and indicates thememory pressure. Portions of the physical memory that have been freed bythe registered applications may then be released back to the operatingsystem.

Additional features of the present invention will be set forth in partin the description which follows, and in part will be obvious from thedescription, or may be learned by practice of the invention. It is to beunderstood that both the foregoing general description and the followingdetailed description are exemplary and explanatory only and are notrestrictive of the invention, as claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of this specification, illustrate embodiments of the invention andtogether with the description, serve to explain the principles of theinvention. In the figures:

FIG. 1 illustrates an exemplary system that is in accordance withembodiments of the present invention;

FIG. 2 illustrates an exemplary architecture of the system shown in FIG.1;

FIG. 3 illustrates an exemplary process flow for an operating system tocooperate with one or more applications that is in accordance withembodiments of the present invention; and

FIG. 4 illustrates an exemplary process flow for an application tocooperate with the operating system in accordance with embodiments ofthe present invention.

DESCRIPTION OF THE EMBODIMENTS

Embodiments of the present invention provide a mechanism for anoperating system and applications to cooperate in memory management. Insome embodiments, applications can register with the operating systemfor cooperative memory management. The operating system monitors thememory and determines a memory “pressure” related to the amount ofdemand for the memory. As the memory pressure increases, the operatingsystem provides a memory pressure signal as feedback to the registeredapplications. The operating system may send this signal to indicate itis about to commence evicting pages from the memory or when it hascommenced swapping out application data. In response to the signal, theregistered applications may evaluate the memory pressure, determinewhich data should be freed, if any, and provide this information back tothe operating system. The operating system may then free those portionsof memory relinquished by the applications.

Reference will now be made in detail to exemplary embodiments of theinvention, which are illustrated in the accompanying drawings. Whereverpossible, the same reference numbers will be used throughout thedrawings to refer to the same or like parts. FIGS. 1 and 2 illustrate anexemplary computer system and its architecture in which embodiments ofthe present invention may be implemented. FIGS. 3 and 4 illustrateexemplary process flows used by the operating system and registeredapplications to cooperate on the management of the physical memory.

Referring now to FIG. 1, a computer system 100 is shown that isconsistent with embodiments of the present invention. In general,embodiments of the present invention may be implemented in variouscomputer systems, such as a personal computer, server, workstation, andthe like. However, for purposes of explanation, system 100 is shown as ageneral purpose computer that is well known to those skilled in the art.Examples of the components that may be included in system 100 will nowbe described.

As shown, computer system 100 may include a central processor 102, akeyboard 104, a pointing device 106 (e.g., mouse, or the like), adisplay 108, a main memory 110, an input/output controller 112, and astorage device 114. Processor 102 may further include a cache memory 116for storing frequently accessed information. Cache 116 may be an“on-chip” cache or external cache. System 100 may also be provided withadditional input/output devices, such as a printer (not shown). Thevarious components of the system 100 communicate through a system bus118 or similar architecture.

In addition, computer system 100 may include an operating system (OS)120 that resides in memory 110 during operation. OS 120 is an integratedcollection of routines and programs that service sequencing andprocessing of programs and applications running on computer system 100.OS 120 may provide many services for computer system 100, such asresource allocation, scheduling, input/output control, and memorymanagement. OS 120 may be predominantly software, but may also comprisepartial or complete hardware implementations and firmware. Well knownexamples of operating systems that are consistent with the principles ofthe present invention include Mac OS by Apple Computer, GNU/LINUX, Javaand Sun Solaris by Sun Microsystems, Windows by Microsoft Corporation,Microsoft Windows CE, Windows NT, Windows 2000, and Windows XP. Oneskilled in the art will recognize that system 100 may comprise variousother components, such as multiple processors, additional storagedevices, etc. Such components are well known to those skilled in theart.

FIG. 2 illustrates a general architecture of computer system 100 that isin accordance with embodiments of the present invention. As shown,computer system 100 is running an OS 120. OS 120 may comprise variouscomponents, which are well known to those skilled. Some of thesecomponents will known be further described to illustrate embodiments ofthe present invention. In particular, OS 120 may comprise a memorymanagement module 200 and utilize a resident data cache 202, a pagetable 204, a resident tracking list 206, and a registered applicationlist 208. OS 120 may be coupled to storage 114 and retrieve variouspages of application data that are not stored in memory 110.

As also shown, OS 120 may support the running of any number ofapplications. These applications may be user applications, such asapplications 210 and 212. Applications 210 and 212 may be anyapplication or process and such applications and processes are wellknown to those skilled in the art. As part of its support, OS 120 mayprovide virtual memories for applications 210 and 212, which arerespectively shown as virtual memories 214 and 216.

Virtual memories 214 and 216 are the memory spaces addressed byapplications 210 and 212 and where these applications cache their data.Accordingly, virtual memories 214 and 216 may also be referred to as the“memories” or “caches” of applications 210 and 212, respectively.However, as noted above, virtual memories 214 and 216 utilize addressspaces that are independent of the physical address space of memory 110.

Memory management module 200 provides the mapping and addresstranslation mechanisms by which OS 120 locates those portions of virtualmemories 214 and 216 that reside in memory 110. Memory management module200 also decides which parts of virtual memories 214 and 216 are kept inmemory 110 in resident data cache 202 or in storage 114. Memorymanagement module 200 may then swap in/out data between resident datacache 202 and storage 114 as applications 210 and 212 process data intheir virtual memories 214 and 216.

Memory management module 200 may operate in conjunction with othercomponents of computer system 100 that are not shown in FIG. 2. Forexample, memory management module 200 may operate with a memorymanagement unit associated with processor 102 and maintain several datastructures for managing memory 110. Some of these data structures arebriefly described below.

In addition, memory management module 200 may be configured to monitorthe utilization of memory 110 and determine a memory pressure. Inparticular, as resident data cache 202 is consumed, memory managementmodule 200 may estimate when it is about to commence paging activity.Memory management module 200 may provide a signal to variousapplications, such as applications 210 and 212, to indicate the memorypressure on memory 110. This signal may be in the form of anasynchronous event sent from OS 120 (such as a UNIX signal or a POSIXreal-time signal), or a software interrupt. Alternatively, memorymanagement module 200 may write memory pressure data to a file or devicethat is polled by various applications, such as applications 210 and212. Other signaling protocols are well known to those skilled in theart.

The memory pressure signal from memory management module 200 mayindicate various parameters. For example, the memory pressure signal mayindicate: the total size allocated to resident data cache 202; theamount of free memory in memory 110 or resident data cache 202; theamount of data in the active/inactive lists of resident tracking list206; and the like. One skilled in the art will recognize that memorypressure signal may be any signal that indicates the status of memory110 and/or resident data cache 202.

Memory management module 200 may send its memory pressure signal atvarious times and intervals. For example, memory management module 200may be configured to continuously send the memory pressure signal atfixed intervals. As another example, as resident data cache 202 ormemory 110 are consumed, memory management module 200 may wait until athreshold amount of memory has been consumed before sending the memorypressure signal. This threshold may be set statically, such as at 15% ofremaining memory, or dynamically based upon the rate of memoryconsumption by the applications running. Memory management module 200may send the memory pressure signal before commencing paging activity orwhen paging activity has begun.

In addition, memory management module 200 may modulate the frequencythat it sends the memory pressure signal. For example, memory managementmodule 200 may send the memory pressure signal more frequently as moreof memory 110 or resident data cache 202 has been consumed. As anotherexample, memory management module 200 may use a set of predeterminedfrequencies based on ranges of utilization such that one frequencyindicates no paging, while another frequency indicates paging activityis about to begin, and yet another indicates that paging activity hascommenced.

Page table 204 provides a mapping between the virtual address space ofvirtual memories 214 and 216 and the physical address space of memory110. In some embodiments, page table 204 may be used in conjunction witha translation lookaside buffer (TLB) (not shown), which are well knownto those skilled in art. Typically, page table 204 is accessed byextracting the virtual page frame number and offset of the desired data.The virtual page frame number serves as an index to page table 204 toretrieve a physical page frame number. The physical address may then bedetermined by multiplying the page size by the physical page framenumber and adding the offset (if needed). The use and structure of pagetable 204 is well known to those skilled in the art. Of course, othermapping schemes may be employed by embodiments of the present invention.

In some embodiments, OS 120 may be configured to use demand paging.Demand paging is where only pages that are currently use by applications210 or 212 are loaded into memory 110 in resident data cache 202.

Resident tracking list 206 provides memory management module 200information to determine which pages it should be retained and which maybe evicted. Resident tracking list 206 is a list that tracks pages whichcurrently reside in resident data cache 202 and which have been recentlyaccessed by the applications running on OS 120. In some embodiments,resident tracking list 206 may include an active and inactive list suchas those employed by the well known “least recently used” algorithms.

Hence, when free space must be generated in memory 110, memorymanagement module 204 will evict a page from resident data cache 206using well known algorithms.

Registered application list 208 indicates processes and applications,such as applications 210 and 212 that are cooperating with OS 120 inmanaging memory 110. Registered application list 208 may identifyvarious processes and applications using well known identifiers, such asprocess identifiers, etc. In addition, registered application list 208may include information that indicates a relative priority assigned toeach application registered for cooperation. For example, userinteractive applications, such as a browser, may be assigned a higherpriority than a background application. This priority may be assigned byOS 120 or self-configured by the applications themselves. Of course, thepriority may be statically assigned or dynamic based on the operationssystem 100.

Alternatively, embodiments of the present invention may also employ anon-registered application list. Applications on this list may beapplications that elect to have OS 120 decide unilaterally how to managetheir virtual memories.

In some embodiments, memory management module 200 may preferentiallymanage memory 110 based on the information in registered applicationlist 208. For example, memory management module 200 may first turn toapplications that are absent from registered application list 208 foreligible pages to evict. Memory management module 200 may then turn topages from applications on registered application list as a secondary orlast resort. In addition, memory management module 200 may evict pagesfrom applications on registered application list 208 based on thepriorities indicated in that list. Of course, memory management module200 may employ a variety of combinations of preferentially managingmemory 110 based on cooperation with some of the applications.

FIG. 3 illustrates an exemplary process flow for OS 120 to cooperatewith one or more applications that is in accordance with embodiments ofthe present invention. It should be readily apparent to those ofordinary skill in the art that the process flow depicted in FIG. 3represents a generalized schematic illustration and that other stagesmay be added or existing stages may be removed or modified.

As shown in FIG. 3, in stage 300, OS 120 determines the memory pressureon memory 110. In particular, during normal operation, OS 120 maycollect various statistics about the utilization of memory 110 andresident data cache 202. For example, OS 120 may use various systemcalls that obtain memory data, such as inode information, or OS 120 mayexecute a program, such as “free” or “meminfo” to obtain various dataabout memory 110. Based on this data, OS 120 may then determine a memorypressure for memory 110. The memory pressure may, for example, indicatea percentage that memory 110 or resident data cache 202 has beenconsumed. Alternatively, the memory pressure may indicate how much ofmemory 110 or resident data cache 202 remains free for allocation.

In stage 302, OS 120 then prepares a feedback signal that indicates thememory pressure. As noted, OS 120 may prepare this signal in a varietyof forms and protocols, such as an asynchronous event, or a softwareinterrupt. OS 120 may also write the feedback signal as data to a fileor device that is accessible to applications 210 or 212. In addition tothe memory pressure, OS 120 may include timestamp information thatindicates when the memory pressure was measured.

In stage 304, OS 120 identifies applications that have registered tocooperate on managing memory 110. In some embodiments, registration byan application may be voluntary. Alternatively, OS 120 may default toproviding memory pressure signals to all of the applications unless theyspecifically opt out on receiving this information.

OS 120 may also determine a relative priority between applications thathave registered. For example, when registering, an application mayselect its own priority. In particular, user interactive applicationsmay select a higher priority, while background applications may use alower priority. Alternatively, OS 120 may assign each application apriority when it registers. This priority may be statically assigned ordynamically varied. An application's priority may depend on a variety ofcriteria, such as when it was initiated, the amount of resident datacache 202 that it consumes, the rate at which the application consumesresident data cache 202, etc. Of course other criteria may be used todetermine the relative priority between applications, such asfirst-in-first-out, or round-robin.

In stage 306, OS 120 provides the feedback signal to the registeredapplications. In some embodiments, OS 120 may be configured to providethis feedback signal to only those applications that registered. As tonon-registered applications, OS 120 may assume that it can unilaterallymanage the swapping of pages in resident data cache 202 for theseapplications. Accordingly, embodiments of the present invention can beeasily migrated to an operating system, while maintaining backwardscompatibility. As noted, OS 120 may provide the feedback signal invarious forms, such as an asynchronous event, a software interrupt, or awrite to a file or device.

In addition, OS 120 may be configured to provide the feedback signal atvarious times and at various frequencies. In particular, OS 120 may sendthe feedback signal at a fixed interval continuously during itsoperations. Alternatively, OS 120 may normally not send the feedbacksignal until an event or threshold memory pressure has been reached. Forexample, OS 120 may commence sending the feedback signal when it sensesa spike in workload, such as large file download or when one or moreapplications have been started.

As another example, OS 120 may commence sending the feedback signal whenresident data cache 202 has reached a threshold level, such as 85%allocated, or only 15% free. This threshold level may be set staticallyor dynamically based on the operating conditions faced by OS 120. Thethreshold level may be set lower in those instances where the workloadhas been unpredictable or where the rate of memory consumption has beenhigh. Alternatively, the threshold level may be set higher in thoseinstances where the workload has been predictable or where memory 110has ample space. As another example, the threshold level may be set sothat the feedback signal is sent prior to or shortly after memorymanagement module 200 commences swap operations or page eviction.

In some embodiments, OS 120 may be configured to increase the frequencyof the feedback signal as memory pressure increases. For example, OS 120may be configured to double or triple the frequency of feedback signalafter swap operations or page eviction has commenced. OS 120 may use aset of predefined frequencies for the feedback signal or determine thefrequency of the feedback signal based on the memory pressure. Ofcourse, other known algorithms for setting the frequency of the feedbacksignal may be implemented in embodiments of the present invention.

FIG. 4 illustrates an exemplary process flow for an application, such asapplications 210 or 212, to cooperate with OS 120 in accordance withembodiments of the present invention. It should be readily apparent tothose of ordinary skill in the art that the process flow depicted inFIG. 4 represents a generalized schematic illustration and that otherstages may be added or existing stages may be removed or modified.Moreover, for purposes of illustration, it is assumed that application210 has registered to cooperate with OS 120 and the following nowprovides an example of some the steps that may be performed.

As shown in FIG. 4, in stage 400, application 210 may receive thefeedback signal from OS 120 that indicates the memory pressure on memory110. As noted, application 210 may receive this signal in the form of anasynchronous event, or based on a software interrupt generated by OS120. Alternatively, application 210 may be configured to poll a selectedfile maintained by OS 120 or a device for the memory pressureinformation.

In stage 402, application 210 determines the memory pressure on memory110. Application 210 may determine the memory pressure directly from theinformation in the feedback signal. For example, the feedback signal mayindicate that memory 110 has only 15% of its space remaining.

Alternatively, application 210 may determine its own memory pressurebased on the feedback signal. In particular, application 210 maycalculate a memory pressure based on its own local executionenvironment. For example, if application 210 is a user interactiveapplication having long wait times, then application 210 may evaluatethat 15% remaining in memory 110 is a relatively “low” pressure. Incontrast, if application 210 is currently active and requires a largeamount of data, then application 210 may evaluate the same 15% remainingin memory 110 as a “high” pressure. As another example, application 210may interpret the feedback signal as an indication that space in memory110 is ample. In response, application 210 may increase its utilizationand attempt to use more space in memory 110. Accordingly, eachapplication may flexibly determine how to interpret the feedback signalfrom OS 120.

In stage 404, application 210 may determine the cost of freeing some ofvirtual memory 212 back to OS 120. In particular, application 210 maycalculate the cost of swapping a page from virtual memory 212 betweenmemory 110 and storage 114 versus discarding the page and havingprocessor 102 recalculate the data. In many instances, recalculating thedata may result in better performance due to the high cost of I/Obetween memory 110 and storage 114. Application 210 may also use variousalgorithms for cache replacement in virtual memory 212, such as Clock,Clock-Pro, least frequently used, and least frequently used with dynamicaging (LFUDA).

In some embodiments, application 210 may be configured to free a certainamount of virtual memory 212 back to OS 120 each time it receives thefeedback signal. Alternatively, application 210 may be configured tomodulate the amount of virtual memory 212 to free depending on thefrequency of the feedback signal. For example, application 210 maycalculate the frequency of the feedback signal based on timestamps inthe signal. As the frequency increases, application 210 may take moreaggressive (i.e., relinquish more of virtual memory 212) actions.Application 210 may escalate its actions in various ways, such aslinearly, geometrically, or exponentially, depending upon the increasein frequency of the feedback signal.

In addition, application 210 may escalate depending upon its own nature.For example, if application 210 is a background application that isrelatively insensitive to latency, then it may be configured toaggressively free its portions of virtual memory 212. Thus, theindividual responses of the applications may vary in embodiments of thepresent invention.

In stage 406, OS 120 determines which portions of memory 110 andresident data cache 202 can be freed. In some embodiments, OS 120 may beconfigured to free those pages from applications in which it iscooperating, e.g., application 210. Alternatively, OS 120 may beconfigured to free pages preferentially. That is, OS 120 may first electto free pages from applications that have registered for cooperation andthen turn to non-registered applications as a secondary or last resort,and vice versa.

In addition, OS 120 may be configured to preferentially free pages amongthe registered applications. In particular, OS 120 may referenceregistered application list 208 and determine a priority for eachregistered application. OS 120 may then free pages from the registeredapplications based on their priority.

Furthermore, OS 120 may be configured to begin unilaterally free pagesof memory 110 and resident data cache 202 in various circumstances. Forexample, OS 120 may commence unilaterally freeing pages when all ofmemory 110 has been consumed or when a sharp increase in workload hasbeen detected. OS 120 may then re-initiate cooperation with theregistered applications, such as application 210, once workload asstabilized or when space in memory 110 becomes available.

Certain embodiments may be performed as a computer program. The computerprogram may exist in a variety of forms both active and inactive. Forexample, the computer program can exist as software program(s) comprisedof program instructions in source code, object code, executable code orother formats; firmware program(s); or hardware description language(HDL) files. Any of the above can be embodied on a computer readablemedium, which include storage devices and signals, in compressed oruncompressed form. Exemplary computer readable storage devices includeconventional computer system RAM (random access memory), ROM (read-onlymemory), EPROM (erasable, programmable ROM), EEPROM (electricallyerasable, programmable ROM), and magnetic or optical disks or tapes.Exemplary computer readable signals, whether modulated using a carrieror not, are signals that a computer system hosting or running thepresent invention can be configured to access, including signalsdownloaded through the Internet or other networks. Concrete examples ofthe foregoing include distribution of executable software program(s) ofthe computer program on a CD-ROM or via Internet download. In a sense,the Internet itself, as an abstract entity, is a computer readablemedium. The same is true of computer networks in general.

Other embodiments of the invention will be apparent to those skilled inthe art from consideration of the specification and practice of theinvention disclosed herein.

1. A method of providing a feedback signal that indicates a memorypressure in a computer system, said method comprising: determining amemory pressure on a physical memory in the computer system; determininga feedback signal that indicates the memory pressure; identifyingapplications running on the computer system that have registered for thesignal; and providing the feedback signal to the registeredapplications.
 2. The method of claim 1, wherein identifying applicationsrunning on the computer system that have registered for the signalcomprises identifying user-space applications running on the computerthat have registered for the signal.
 3. The method of claim 1, whereindetermining the feedback signal comprises: determining when a thresholdof the physical memory has been consumed; and determining the feedbacksignal when the threshold of the physical memory has been consumed. 4.The method of claim 1, wherein providing the feedback signal to theregistered applications comprises providing an asynchronous event to theregistered applications.
 5. The method of claim 1, wherein providing thefeedback signal to the registered applications comprises sending asoftware interrupt.
 6. The method of claim 1, wherein providing thefeedback signal to the registered applications comprises writinginformation that indicates a status of the physical memory to a filethat is accessible to the registered applications.
 7. The method ofclaim 1, wherein providing the feedback signal to the registeredapplications comprises writing information that indicates a status ofthe physical memory to a device that is accessible to the registeredapplications.
 8. The method of claim 1, wherein providing the feedbacksignal to the registered applications comprises providing the feedbacksignal to the registered applications at a predetermined frequency. 9.The method of claim 1, wherein providing the feedback signal to theregistered applications comprises providing the feedback signal to theregistered applications at a frequency that is based on the memorypressure.
 10. An apparatus comprising means that are configured toperform the method of claim
 1. 11. A computer readable medium comprisingexecutable instructions for performing the method of claim
 1. 12. Amethod for an application to cooperate with an operating system, whereinthe operating system provides the application a virtual memory, andwherein the operating system maps at least a portion of the virtualmemory to a physical memory, said method comprising: receiving, from theoperating system, a feedback signal that indicates a memory pressure onthe physical memory; determining, by the application, a cost of freeingat least some of its virtual memory based on the memory pressure; andreleasing, by the application, at least some of its virtual memory basedon the cost of freeing and the feedback signal.
 13. The method of claim12, wherein receiving the feedback signal comprises receiving anasynchronous event from the operating system.
 14. The method of claim12, wherein receiving the feedback signal comprises detecting a softwareinterrupt generated from the operating system.
 15. The method of claim12, wherein receiving the feedback signal comprises polling a file. 16.The method of claim 12, wherein receiving the feedback signal comprisespolling a device.
 17. The method of claim 12, wherein determining thecost of freeing at least some of the virtual memory of the applicationcomprises: estimating an amount of time to swap one or more pages of thevirtual memory between the physical memory and a storage device; andestimating an amount of time to discard data in the one or more pages ofthe virtual memory and recalculate the data.
 18. The method of claim 12,wherein releasing at least some of the virtual memory of the applicationcomprises: determining a frequency that the memory pressure has beenreceived; and freeing an amount of virtual memory to the operatingsystem based on the frequency of the feedback signal.
 19. The method ofclaim 12, wherein releasing at least some of the virtual memory of theapplication comprises freeing an amount of virtual memory to theoperating system each time the application receives the feedback signal.20. An apparatus comprising means that are configured to perform themethod of claim
 12. 21. A computer readable medium comprising executableinstructions to perform the method of claim
 12. 22. A method of managinga physical memory in a computer system based on cooperation between anoperating system and an application, said method comprising:determining, by the operating system, a memory pressure on the physicalmemory; registering one or more applications that are configured tocooperate with the operating system; sending, to the registeredapplications, a feedback signal that indicates the memory pressure; andreleasing portions of the physical memory that have been freed by theregistered applications.
 23. The method of claim 22, wherein sending thefeedback signal to the registered applications comprises sending thefeedback signal at a frequency that is proportional to the memorypressure on the physical memory.
 24. The method of claim 22, whereinsending the feedback signal to the registered applications comprisessending the feedback signal when the memory pressure has reached athreshold.
 25. The method of claim 22, wherein sending the feedbacksignal to the registered applications comprises sending the feedbacksignal prior to commencement of pages being evicted from the physicalmemory.
 26. The method of claim 22, wherein sending the feedback signalto the registered applications comprises sending the feedback signalwhen pages are being evicted from the physical memory.
 27. The method ofclaim 22, wherein releasing portions of the physical memory that havebeen freed by the registered applications comprises: identifyingapplications that have not registered to cooperate with the operatingsystem; and releasing portions of the physical memory for theapplications that have not registered before releasing portions of thephysical memory that have been freed by the registered applications. 28.The method of claim 22, wherein releasing portions of the physicalmemory that have been freed by the registered applications comprises:determining a frequency of the feedback signal; and releasing portionsof the physical memory at an amount that is in proportion to thefrequency of the feedback signal.
 29. The method of claim 22, whereinthe registered applications are configured to free at least some of thephysical memory for each time they receive the feedback signal.
 30. Anapparatus comprising means configured to perform the method of claim 22.31. A computer readable medium comprising executable instructions forperforming the method of claim 22.